<?php
namespace Admin\Controller;
use Think\Controller;
class AdminController extends Controller {
    public function login() {
        $this->assign('title', C('WEB_TITLE'));
        $this->display(':login');
    }

    public function gm_login() {
        $username       = I('post.username');
        $password       = I('post.password');

        if ($username == C('ADMIN_USER') && $password == C('ADMIN_PASS')) {
            $_SESSION['ADMIN_USER'] = $username;
            $this->success('登录成功', U('Index/index'));
        } else {
            $this->error('登录失败');
        }
    }

    public function gm_logout() {
        unset($_SESSION['ADMIN_USER']);
        $this->success('登出成功', U('Index/index'));
    }
}
